package duck;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;

import map.Map;
import base_object.ABaseMoveable;
import base_object.ABaseObject;

public abstract class ABlock extends ABaseMoveable {
	public ABlock(Map map) {
		super(map);
		setPriority(2);
	}

	private ArrayList<ABaseObject> objectsList =  new ArrayList<ABaseObject>();
	public ArrayList<ABaseObject> getObjectsList() {
		return objectsList;
	}

	public ArrayList<ABaseObject> getList() {
		return objectsList;
	}
	
	public BufferedImage rotate(BufferedImage oldImage, double angle) {

		BufferedImage buffer = new BufferedImage(oldImage.getHeight(),
				oldImage.getWidth(), oldImage.getType());

		Graphics2D graphics = (Graphics2D) buffer.getGraphics();
		graphics.rotate(Math.toRadians(angle), buffer.getWidth() / 2,
				buffer.getHeight() / 2);
		graphics.translate((buffer.getWidth() - oldImage.getWidth()) / 2,
				(buffer.getHeight() - oldImage.getHeight()) / 2);
		graphics.drawImage(oldImage, 0, 0, oldImage.getWidth(),
				oldImage.getHeight(), null);
		oldImage = buffer;
		return buffer;
	}
	
}